package com.easemob.chat;

import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;

public class EMContact
  implements Parcelable
{
  protected String eid;
  protected String username;
  protected String nick;
  public static final Parcelable.Creator<EMContact> CREATOR = new Parcelable.Creator()
  {
    public EMContact createFromParcel(Parcel paramAnonymousParcel)
    {
      return new EMContact(paramAnonymousParcel, null);
    }

    public EMContact[] newArray(int paramAnonymousInt)
    {
      return new EMContact[paramAnonymousInt];
    }
  };

  protected EMContact()
  {
  }

  public EMContact(String paramString1, String paramString2)
  {
    this.eid = paramString1;
    if (paramString2.contains("@"))
      this.username = EMContactManager.getUserNameFromEid(paramString2);
    else
      this.username = paramString2;
  }

  public EMContact(String paramString)
  {
    if (paramString.contains("@"))
    {
      this.eid = paramString;
      this.username = EMContactManager.getUserNameFromEid(paramString);
    }
    else
    {
      this.username = paramString;
      this.eid = EMContactManager.getEidFromUserName(paramString);
    }
  }

  public void setUsername(String paramString)
  {
    this.username = paramString;
  }

  public String getUsername()
  {
    return this.username;
  }

  public void setNick(String paramString)
  {
    this.nick = paramString;
  }

  public String getNick()
  {
    if (this.nick == null)
      return this.username;
    return this.nick;
  }

  public int compare(EMContact paramEMContact)
  {
    return getNick().compareTo(paramEMContact.getNick());
  }

  public String toString()
  {
    return "<contact jid:" + this.eid + ", username:" + this.username + ", nick:" + this.nick + ">";
  }

  public int describeContents()
  {
    return 0;
  }

  public void writeToParcel(Parcel paramParcel, int paramInt)
  {
    paramParcel.writeString(this.eid);
    paramParcel.writeString(this.username);
  }

  private EMContact(Parcel paramParcel)
  {
    this.eid = paramParcel.readString();
    this.username = paramParcel.readString();
  }

  public String getEid()
  {
    return this.eid;
  }

  public void setEid(String paramString)
  {
    this.eid = paramString;
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     com.easemob.chat.EMContact
 * JD-Core Version:    0.6.1
 */